<?php


namespace App\Controller\Client;


use App\Controller\AbstractController;
use App\Request\Client\Notice\EmployerNoticeRequest;
use App\Request\Client\Notice\UserNoticeRequest;
use App\Service\Client\NoticeService;
use Hyperf\Di\Annotation\Inject;

class NoticeController extends AbstractController
{
    /**
     * @Inject()
     * @var NoticeService
     */
    protected $noticeService;


    //TODO 悬赏主未读数
    //TODO 悬赏主未读置为已读

    /**
     * 用户通知未读数
     * @return \Psr\Http\Message\ResponseInterface
     */
    public function userNoticeNotRead(){
        $data = $this->noticeService->userNoticeNotRead();
        return $this->response->success($data);
    }

    /**
     * 用户通知列表
     * @param UserNoticeRequest $request
     * @return \Psr\Http\Message\ResponseInterface
     */
    public function userNotice(UserNoticeRequest $request)
    {
        $validator = $request->validated();
        $data = $this->noticeService->userNotice($validator);
        return $this->response->success($data);
    }


    /**
     * 悬赏主通知未读数
     * @return \Psr\Http\Message\ResponseInterface
     */
    public function employerNoticeNotRead(){
        $data = $this->noticeService->employerNoticeNotRead();
        return $this->response->success($data);
    }

    /**
     * 悬赏主通知列表
     * @param EmployerNoticeRequest $request
     * @return \Psr\Http\Message\ResponseInterface
     */
    public function employerNotice(EmployerNoticeRequest $request)
    {
        $validator = $request->validated();
        $data = $this->noticeService->employerNotice($validator);
        return $this->response->success($data);
    }

}